<?php

namespace App\Http\Requests\Plane\Rules;

use Illuminate\Foundation\Http\FormRequest;

class RuleQueryRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, mixed>
     */
    public function rules()
    {
        return [
            "cabin"        => "required",
            "depart_date"  => "required",
            "carrier_code" => "required|min:2",
        ];
    }

    public function messages()
    {
        return [
            "cabin.required"        => "舱位不能空",
            "depart_date.required"  => "出发时间不能空",
            "carrier_code.required" => "航司码或航班号不能为空",
            "carrier_code.min"      => "航司码或航班号错误",
        ];
    }
}
